import Picker from 'react-native-picker';
import { hidden } from 'ansi-colors';
let data = [];
for (var i = 0; i < 100; i++) {
  data.push(i);
}

const options = {
  pickerConfirmBtnText:'确定',
  pickerCancelBtnText:'取消',
  pickerTitleText:'请选择',
  pickerData:[],
  pickerConfirmBtnColor: [0, 0, 0, 1],
  pickerCancelBtnColor: [0, 0, 0, 1],
  pickerTitleColor: [0, 0, 0, 1],
  pickerBg: [244, 244, 244, 1],
  pickerToolBarBg: [255, 255, 255, 1],
  pickerToolBarFontSize: 15,
  pickerFontSize: 15,
  selectedValue: [0],
}

export default {
  show(props) {
    this.params = Object.assign({},options,props);
    let initOptions = {
      ...this.params,
      onPickerConfirm: data => {
        if (props&&props.onPickerConfirm) {
          props.onPickerConfirm(data);
        }
      },
      onPickerCancel: data => {
        if (props&&props.onPickerCancel) {
          props.onPickerCancel();
        }
      },
      onPickerSelect: data => {
       if (props&&props.onPickerSelect) {
         props.onPickerSelect();
       }
      }
    }
    Picker.init(initOptions);
    Picker.show();
  },

  hide() {
    Picker.hide();
  },

  toggle() {
    Picker.toggle();
  }
}



